<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

session_start();

require_once 'includes/connect.php';
require_once 'includes/function.php';

$task = $_REQUEST["task"];

$db = new myDBS();

$id = $_REQUEST["id"];
$group_name = $_REQUEST["group_name"];

switch ($task) {
    case "new":
       
        $sql = "INSERT INTO tbl_debtor_group (group_name)"
                . " VALUES ('$group_name')";
        
        //echo $sql;
        $db->runSQL($sql) or die(mysql_error());
        break;
    case "edit":
        $sql = "UPDATE tbl_debtor_group "
            . " SET group_name = '$group_name'"
            . " WHERE id = '$id'";
        
        $db->runSQL($sql) or die(mysql_error());
        break;
    case "del":
        
        $sql = "DELETE FROM tbl_debtor_group "
            . " WHERE id = '$id'";
        
        $db->runSQL($sql) or die(mysql_error());
        break;
    
    
}
?>

